package logic

import (
	"activity_srv/activity"
	"activity_srv/internal/dao"
	"activity_srv/internal/svc"
	"context"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetUserWithdrawListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetUserWithdrawListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserWithdrawListLogic {
	return &GetUserWithdrawListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 提现流水列表
func (l *GetUserWithdrawListLogic) GetUserWithdrawList(in *activity.GetUserWithdrawListRequest) (*activity.GetUserWithdrawListResponse, error) {
	//调用业务逻辑
	withdrawList, err := dao.GetUserWithdrawList(in)
	if err != nil {
		pkg.Error("获取提现流水列表失败", zap.Error(err))
		return nil, err
	}
	pkg.Info("获取提现流水列表成功", zap.Any("withdrawList", withdrawList))

	return &activity.GetUserWithdrawListResponse{
		List: withdrawList,
	}, nil
}
